use $data/Table_1_Final.dta, replace	

// TABLE 1
gen dummy=0
foreach i of varlist unplug_appliances buy_energy_efficient turnoff_ac switchoff_lights change_appliance_setting{
local label : variable label `i'
quietly replace dummy=(`i'=="Always" | `i'=="Often")
quietly tab dummy if dummy==1
local n=`r(N)'
forvalues j=7/16{
quietly tab mot_`i' if regexm(mot_`i',"`j'") & dummy==1 
local n`j'=`r(N)'
local share`j'=round(`n`j''/`n',.0001)*100

quietly tab id1 if mot_`i'=="" & dummy==1
local nmiss=`r(N)'
local sharemiss=round(`nmiss'/`n',.0001)*100

}
display "`label'&`share7'&`share8'&`share9'&`share10'&`share11'&`share12'&`share13'&`share14'&`share15'&`share16'&`sharemiss'"
display "&(`n7')&(`n8')&(`n9')&(`n10')&(`n11')&(`n12')&(`n13')&(`n14')&(`n15')&(`n16')&(`nmiss')"
}
// 

// HEADER FOR TABLE 1
display "Action&Money&Habit&Necessity&Health&Future Generations&Environmental Friendly&Trends&Ethical/Moral&Cultural&Other&No Response"




/*
// THIS DO FILE WILL PRODUCE THIS OUTPUT IN
COPY AND PASTE THIS INTO WORD, HIGHLIGHT, AND CONVERT TEXT TO TABLE USING THE & AS THE DELIMITER

Action&Money&Habit&Necessity&Health&Future Generations&Environmental Friendly&Trends&Ethical/Moral&Cultural&Other&No Response
Unplug Appliances&70.42&29.19&6.72&.58&3.27&8.9&.26&2.3&.26&4.99&.77
&(1100)&(456)&(105)&(9)&(51)&(139)&(4)&(36)&(4)&(78)&(12)
Buy Energy Efficient Appliances&61.58&10.57&9.81&.90&6.91&21.08&4.01&1.73&.14&4.91&.900
&(891)&(153)&(142)&(13)&(100)&(305)&(58)&(25)&(2)&(71)&(13)
Turn Off AC&65.94&22.75&12.06&.07&3.61&11.44&.41&2.32&.14&4.84&1.23
&(968)&(334)&(177)&(1)&(53)&(168)&(6)&(34)&(2)&(71)&(18)
Turn Off Lights&60.3&23.31&10.3&2.39&3.87&13.1&.82&2.39&.16&7.58&1.65
&(732)&(283)&(125)&(29)&(47)&(159)&(10)&(29)&(2)&(92)&(20)
Change Appliance Settings&38.71&18.55&10.38&11.49&2.62&14.21&2.32&3.23&.3&13.81&2.82
&(384)&(184)&(103)&(114)&(26)&(141)&(23)&(32)&(3)&(137)&(28)
